package com.dinnerorders.common.services;

/**
 * @author Sergey Nalivko e-mail: snalivko93@gmail.com
 */
public interface DAO<T> {
    /**
     * Finds entity in database
     * @param id identifier for searching
     * @return found entity in case the entity with such identifier was found and null otherwise
     */
    public <T> T find(Class<T> entityClass, Object id);

    /**
     * Updates entity's data in database
     * @param o entity for updating
     * @return updated entity
     */
    public <T> T update(T o);

    /**
     * Removes entity from database
     * @param id identifier of the entity to be deleted
     */
    public void delete(T id);

    /**
     * Saves entity into database
     * @param o the entity to be saved
     */
    public void save(T o);
}
